export default {
	/* 获取日期和周 */
	getDateWeek() { /* 得到当前日期的时间戳 */
		const timestamp = Date.now()
		const date=new Date()
		// const timestamp = new Date(2019, 7, 30, 0, 0, 0, 0).getTime()
		// const month = date.getMonth();
		const dateWeek = Array.from(new Array(7)).map((_, i) => {
			/* 得到当前周每一天的时间戳 */
			const weekTimestamp = new Date(timestamp + i * 24 * 60 * 60 * 1000)
			const date = String(weekTimestamp.getMonth() + 1).padStart(2, '0') + '.' +String(new Date(weekTimestamp).getDate()).padStart(2, '0')
			const year=weekTimestamp.getFullYear();
			const month=weekTimestamp.getMonth() + 1
			/* 得到周几后转换 */
			let week = weekTimestamp.getDay()
			switch (week) {
				case 0:
					week = '周日'
					break
				case 1:
					week = '周一'
					break
				case 2:
					week = '周二'
					break
				case 3:
					week = '周三'
					break
				case 4:
					week = '周四'
					break
				case 5:
					week = '周五'
					break
				case 6:
					week = '周六'
					break
			}
			return {
				date,
				week,
				year,
				month
			}
			
		})
		return {
			dateWeek
		}
	},
}
